package com.itopia.team04;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import com.itopia.team04.models.MenuFragment;
import com.itopia.team04.models.SlideMenuHelper;

public class MenuActivity extends FragmentActivity {
	
	private SlideMenuHelper smh;

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    smh = new SlideMenuHelper(this);
	    smh.activate();
	    getSupportFragmentManager().beginTransaction().add(R.id.slideout_placeholder, new MenuFragment(), "menu").commit();
	    smh.open();
	}

	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if(keyCode == KeyEvent.KEYCODE_BACK){
			smh.close();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}


	public SlideMenuHelper getSlideMenuHelper(){
		return smh;
	}

}
